<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/javascript">
        function text(){
            let today = new Date();
            let divdate = document.getElementById("date");
            divdate.innerHTML = "今天是:"+today.getFullYear()+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日";
            divdate.innerHTML += "，星期"+today.getDay()+",";
            divdate.innerHTML += today.getHours()+":"+today.getMinutes()+":"+today.getSeconds(); 
        }
        window.addEventListener("load",text,false);
    </script>
</head>
<body>
    <div id="date"></div>
    <button>测试</button>
</body>
</html>